<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证API</title>
</head>
<body>
<H1 style="text-align: center">
    验证API的使用。输入数字
</H1>
<hr>
<input id="id1" type="number" min="0" max="100" required>
<button onclick="myFunction()">验证</button>

<p id="dome"></p>

<script>
    function myFunction() {
        var inpObj = document.getElementById("id1");
        if (inpObj.checkValidity()==false) {
            document.getElementById("dome").innerHTML = inpObj.validationMessage;
        } else {
            document.getElementById("dome").innerHTML = "输入正确";
        }
    }

</script>


</body>
</html>